package com.jnidemo;

public class JniDemo {

	// 声明本地方法
    public native int add(int a, int b);
    
    public native int sub(int a, int b);
    
    public native double acl();
    
    static {
    	/**
    	 * https://learn.microsoft.com/zh-CN/cpp/windows/latest-supported-vc-redist?view=msvc-170
    	 * 
    	 * https://www.cnblogs.com/ylz8401/p/9605498.html
    	 */
    	System.out.println(System.getProperty("java.library.path"));
        // 加载DLL文件 x86
//        System.load("C:\\Users\\TR\\source\\repos\\jnidemo\\Debug\\jnidemo.dll");
    	// x64
    	 System.load("C:\\Users\\TR\\source\\repos\\jnidemo\\x64\\Debug\\jnidemo.dll");
    }
    
    public static void main(String[] args) {
    	JniDemo ob = new JniDemo();
    	System.out.println(ob.add(1, 2));
    	System.out.println(ob.sub(2, 3));
    	System.out.println("--------------------");
    	System.out.println(ob.acl());
	}
    
}
